<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:if test="${est.estType=='CLIENT'}"><c:set var="${estType}" value="客户" /></c:if>
<c:if test="${est.estType=='COOPERATOR'}"><c:set var="${estType}" value="外协商" /></c:if>
<c:set var="pageTitle" value="${estType}附件" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doDownload(id,fileName,sourceName){
		var xmlHttp=createXMLHttpRequest();
		xmlHttp.open("GET", "/FileDownloadLog.ihtm?id="+id);
		xmlHttp.onreadystatechange = function(){
			doDownloadCallback(xmlHttp,fileName,sourceName);
		};
		xmlHttp.send(null);
	}
	function doDownloadCallback(xmlHttp,fileName,sourceName){
    	if (xmlHttp.readyState == 4) {
      		if (xmlHttp.status == 200) {
      			var resTxt=xmlHttp.responseText;
      			if(resTxt=="NO_LOGIN"){
      				ShowAlert('提示框','你还没登录或已经超时，请重新登录。',200,100);
      			}else if(resTxt=="OK"){
      				window.location="/FileDownload.ihtm?file_name="+encodeURIComponent(fileName)+"&source_name="+encodeURIComponent(sourceName);
      			}
			}
		}
	}
	function doJump(pageIndex){
		if(window.event.keyCode==13){
			doGo(pageIndex);
		}
	}
	function doGo(pageIndex){
		window.location="/base/AccessoryListForEstablishment.ihtm?est_id=${estId}&current_page="+pageIndex;
	}
	function doDelete(id){
		ShowConfirm('确认框','确定删除吗？',340,80,"doDelAct("+id+")");
	}
	function doDelAct(id){
		if(popRetVal!=null){
			var fromUrl=encodeURIComponent(window.location);
			window.location="/business/AccessoryDelete.ihtm?id="+id+"&from_url="+fromUrl;
		}
	}
</script>
</head>
<body class="sheet" style="text-align:center;">
<div class="sheet-main" style="width:860px;text-align:left;margin:auto;">
	<div class="sheet-top">
		<div class="content">
		  <h2>${estType}附件</h2>
		  <p>${estType}名称：${est.estName}</p>
		</div>
	</div>
	  <div class="sheet-list">
			  <div class="table-list">
			     <table width="100%" align="center">      
					 <tr>			   		
						<th width="25%">文件</th>
						<th width="25%">资料路径</th>
						<th width="20%">文件说明</th>
						<th width="10%">上传人</th>
						<th width="10%">上传时间</th>
						<th width="10%">操作</th>
					</tr>
					<c:forEach var="item" items="${list}">
					<tr>
						<td >
							<c:if test="${item.fileName!=null && item.fileName!=''}"><a href="${item.fileName}" target="_blank">${item.sourceName}</a></c:if>
							<c:if test="${item.fileName==null || item.fileName==''}">${item.sourceName}</c:if>
						</td>
						<td >${item.customPath}</td>
						<td >${item.mark}</td>
						<td >${item.createrName}</td>
						<td ><fmt:formatDate value="${item.createTime}" pattern="yyyy-MM-dd"/></td>
						<td >
							<c:if test="${item.fileName!=null && item.fileName!=''}"><a href="javascript:doDownload('${item.id}','${item.fileName}','${item.sourceName}');">下载</a></c:if>
							<c:if test="${item.fileName==null || item.fileName==''}">下载</c:if>
							<a href="javascript:doDelete('${item.id}');">删除</a>
						</td>
					</tr>
					</c:forEach>
				</table>
			  </div>
			</div>
</div>
</body>
</html>